﻿@{
    ViewBag.Title = "DetailPurchaseOrder";
}
@using SAB.Domain.Acquisition
@using SAB.Domain.Publication

<div class="row">
    <div class="col-md-12">
        <ol class="breadcrumb">
            <li>@Html.ActionLink("Home", "Index", "Home")</li>
            <li>@Html.ActionLink("Orden de Compra", "Search", "PurchaseOrder")</li>
            <li class="active">Detalle Orden de Compra</li>
        </ol>
    </div>
</div>

<div class="row">
    <div class="col-md-10">
        <h1 class="title text-left">Recepción de Orden de Compra</h1>

        <div class="form-group">
            <div class="row">
                <div class="col-md-8">
                    <label for="searchText">Código</label>

                    <input type="text" class="form-control" value="@(((PurchaseOrder)ViewData["PurchaseOrder"]).Id)" disabled="disabled">


                </div>
            </div>
            <div class="row">
                <div class=" col-md-4">
                    <label for="searchText">Fecha de Recepción</label>
                    <input type="text" class="form-control" placeholder="" disabled="disabled" value="15/01/2013">
                    <label for="searchText">Proveedor</label>

                    <div class="input-group">
                        <input type="text" class="form-control" disabled="disabled" value="@(((PurchaseOrder)ViewData["PurchaseOrder"]).PurchaseOrder_Provider.Name)">

                    </div><!-- /input-group -->

                </div>





            </div>

        </div>
        <form action="@Url.Action("ReceptionSave", "PurchaseOrder")" class="form-horizontal" method="post" role="form">
            <div class="form-group">
                <div class="row">
                    <div class=" col-md-8">

                        <div class="panel panel-default">
                            <!-- Default panel contents -->
                            <div class="panel-heading text-center">Materiales</div>
                            <!-- Table -->
                            <table class="table">
                                <tr>
                                    <th class="col-md-1">Código</th>
                                    <th class="col-md-8">Producto</th>
                                    <th class="col-md-2">Cantidad</th>
                                    <th class="col-md-2">Cantidad recibida</th>
                                    <th class="col-md-1">Cantidad a recibir</th>

                                </tr>

                                @foreach (var purchaseOrderDetail in (IEnumerable<PurchaseOrderDetail>)ViewData["PurchaseOrderDetails"])
                                {


                                    <tr>
                                        @{int a = @purchaseOrderDetail.Cantidad - @purchaseOrderDetail.CantidadRecibida;

                                        <td>@purchaseOrderDetail.IdPublication<input type="number" name="publicationIDs" value="@purchaseOrderDetail.IdPublication" hidden></td>
                                            <td>@purchaseOrderDetail.PublicationName<input type="number" name="purchaseOrderDetailIDs" value="@purchaseOrderDetail.Id" hidden></td>
                                            <td>@purchaseOrderDetail.Cantidad<input type="number" name="publicationQuantities" value="@purchaseOrderDetail.Cantidad" hidden></td>
                                            <td>@purchaseOrderDetail.CantidadRecibida<input type="number" name="publicationQuantitiesReceived" value="@purchaseOrderDetail.CantidadRecibida" hidden></td>
                                            <td class="col-md-1"><input type="number" name="publicationQuantitiesPlus" required min="0" max="@a"></td>
                                        }
                                    </tr>

                                }

                            </table>
                        </div>
                    </div>

                </div>
            </div>



            <div class=" col-md-8">

                <div class="col-md-3">
                    @Html.ActionLink("Cancelar", "Search", "PurchaseOrder", new { id = 1 }, new { @class = "btn btn-primary pull-right" })
                </div>


                <div class="col-md-3">
                    <button type="submit" class="btn btn-primary pull-right">
                        Guardar
                    </button>
                </div>
        </form>
        <!--
        <div class="col-md-3">
            @Html.ActionLink("Guardar", "Show", "Publication", new { id = 1 }, new { @class = "btn btn-primary pull-right" })
        </div>
        <div class="col-md-3">
            @Html.ActionLink("Eliminar", "Show", "Publication", new { id = 1 }, new { @class = "btn btn-primary pull-right" })
        </div>
            -->
        <!--BOTON
        <button type="button" class="btn btn-primary pull-right">
            Action
        </button>
            -->
    </div>
    </div>
</div>
